//
//  MyTableViewCell.m
//  UI11_UITableView综合练习
//
//  Created by Marry W. on 15/12/21.
//  Copyright © 2015年 www.lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "MyTableViewCell.h"

@implementation MyTableViewCell

#pragma mark - dealloc
- (void)dealloc
{
    [_nameLabel release];
    [_phoneLabel release];
    [_hobbyLabel release];
    [super dealloc];
}

#pragma mark - 初始化
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // 初始化自定义cell上的控件
        // name
        self.nameLabel = [[UILabel alloc] init];
        _nameLabel.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_nameLabel];
        [_nameLabel release];
        // phone
        self.phoneLabel = [[UILabel alloc] init];
        _phoneLabel.backgroundColor = [UIColor orangeColor];
        [self.contentView addSubview:_phoneLabel];
        [_phoneLabel release];
        // hobby
        self.hobbyLabel = [[UILabel alloc] init];
        _hobbyLabel.backgroundColor = [UIColor yellowColor];
        [self.contentView addSubview:_hobbyLabel];
        [_hobbyLabel release];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    _nameLabel.frame = CGRectMake(20, 20, self.contentView.bounds.size.width - 40, 40);
    CGRect f = _nameLabel.frame;
    f.origin.y += 60;
    _phoneLabel.frame = f;
    f.origin.y += 60;
    _hobbyLabel.frame = f;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
